/* Futuristic neon theme - LIGHT variant */
:root {
  --neo-bg: #f6f8ff;
  --neo-card: #ffffff;
  --neo-text: #0b1220;
  --neo-subtext: #5b6478;
  --neo-primary: #1668dc;
  --neo-accent: #22d3ee;
  --neo-glow: 0 0 24px rgba(22,104,220,0.12), 0 0 48px rgba(34,211,238,0.08);
  --neo-border: rgba(10, 18, 32, 0.12);
}

/* Futuristic neon theme - DARK variant */
body.dark-theme {
  --neo-bg: #0b1220;
  --neo-card: #111a2e;
  --neo-text: #e6f0ff;
  --neo-subtext: #a4b1c9;
  --neo-primary: #3b82f6;
  --neo-accent: #22d3ee;
  --neo-glow: 0 0 28px rgba(34,211,238,0.18), 0 0 64px rgba(59,130,246,0.12);
  --neo-border: rgba(230, 240, 255, 0.14);
}

html, body, #app {
  background: radial-gradient(1200px 1200px at 10% 10%, rgba(34,211,238,0.06), transparent 60%),
              radial-gradient(1000px 1000px at 90% 10%, rgba(22,104,220,0.06), transparent 60%),
              var(--neo-bg) !important;
  color: var(--neo-text);
}

/* Dark grid overlay for subtle tech texture */
body.dark-theme {
  background: radial-gradient(1200px 1200px at 10% 10%, rgba(34,211,238,0.08), transparent 60%),
              radial-gradient(1000px 1000px at 90% 10%, rgba(59,130,246,0.08), transparent 60%),
              linear-gradient(0deg, transparent 24%, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.02) 26%, transparent 27%, transparent 74%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.02) 76%, transparent 77%),
              linear-gradient(90deg, transparent 24%, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.02) 26%, transparent 27%, transparent 74%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.02) 76%, transparent 77%),
              var(--neo-bg) !important;
  background-size: auto, auto, 32px 32px, 32px 32px, auto !important;
}

/***** Cards & panels *****/
.ant-card { background: var(--neo-card) !important; border-color: var(--neo-border) !important; box-shadow: var(--neo-glow); }
.ant-card-head { background: linear-gradient(90deg, rgba(22,104,220,0.08), rgba(34,211,238,0.06)); border-bottom: 1px solid var(--neo-border) !important; }
.ant-card-head-title { color: var(--neo-text) !important; }

/* Card body text contrast */
.ant-card .ant-card-body { color: var(--neo-text) !important; }

/***** Buttons *****/
.ant-btn-primary { background: linear-gradient(90deg, var(--neo-primary), var(--neo-accent)) !important; border: none !important; box-shadow: 0 4px 16px rgba(22,104,220,0.18); color: #fff !important; }
.ant-btn-default { border-color: var(--neo-border) !important; color: var(--neo-text) !important; background: var(--neo-card) !important; }
.ant-btn-text { color: var(--neo-primary) !important; }
.ant-btn:hover { filter: brightness(1.03); }

/***** Inputs *****/
.ant-input, .ant-input-affix-wrapper, .ant-input-textarea { background: var(--neo-card) !important; border-color: var(--neo-border) !important; color: var(--neo-text) !important; }
.ant-input::placeholder, .ant-input-textarea::placeholder { color: #98a2b3 !important; }

/***** Header toolbar *****/
.header-toolbar, .preview-header, .overlay-bar { background: rgba(255,255,255,0.7) !important; backdrop-filter: blur(6px); border-bottom: 1px solid var(--neo-border) !important; }
body.dark-theme .header-toolbar, body.dark-theme .preview-header, body.dark-theme .overlay-bar { background: rgba(11,18,32,0.55) !important; }

/***** Sider and layout content *****/
.site-layout .content { background: var(--neo-card) !important; color: var(--neo-text) !important; border: 1px solid var(--neo-border) !important; box-shadow: var(--neo-glow) !important; }
.sidebar { background: var(--neo-card) !important; border-right: 1px solid var(--neo-border) !important; }

/***** Menu *****/
.ant-menu { background: transparent !important; }
.ant-menu-item-selected { background: linear-gradient(90deg, rgba(22,104,220,0.12), rgba(34,211,238,0.10)) !important; border-radius: 0 20px 20px 0 !important; }
body.dark-theme .ant-menu-item { color: var(--neo-text) !important; }
body.dark-theme .ant-menu-item-selected { color: #fff !important; }

/***** Chat area *****/
.messages-container { background: rgba(255,255,255,0.65) !important; border: 1px solid var(--neo-border) !important; }
body.dark-theme .messages-container { background: rgba(17,26,46,0.65) !important; }
.user-message .message-bubble { background: linear-gradient(90deg, rgba(22,104,220,0.9), rgba(34,211,238,0.85)) !important; color: #fff !important; }
.ai-message .message-bubble { background: var(--neo-card) !important; color: var(--neo-text) !important; border: 1px solid var(--neo-border) !important; }
.message-time { color: #7b879b !important; }
body.dark-theme .message-time { color: rgba(230,240,255,0.65) !important; }

/***** Splitter *****/
.splitter { background: linear-gradient(180deg, rgba(22,104,220,0.25), rgba(34,211,238,0.25)) !important; box-shadow: var(--neo-glow); }

/***** Alerts *****/
.ant-alert { background: rgba(22,104,220,0.06) !important; border-color: var(--neo-border) !important; color: var(--neo-text) !important; }
body.dark-theme .ant-alert { background: rgba(34,211,238,0.08) !important; }

/***** Markdown code blocks *****/
.message-text pre, .sel-code pre { background: #f5f7ff !important; border: 1px solid var(--neo-border); color: var(--neo-text) !important; }
body.dark-theme .message-text pre, body.dark-theme .sel-code pre { background: #0f1a2b !important; color: #e6f0ff !important; border-color: rgba(230,240,255,0.14) !important; }

/***** Overlay *****/
.preview-overlay { background: var(--neo-card) !important; }
.overlay-bar span { color: var(--neo-text); }

/***** Preview card *****/
.preview-card .ant-card-head { background: linear-gradient(90deg, rgba(22,104,220,0.10), rgba(34,211,238,0.08)) !important; }
.preview-content { background: var(--neo-card) !important; }

/***** Subtle separators *****/
.ant-card-bordered, .chat-header, .overlay-bar { border-color: var(--neo-border) !important; } 

/* High-contrast on dark backgrounds */
.on-dark, .user-message .message-bubble {
  color: #ffffff !important;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}
.on-dark a, .user-message .message-bubble a { color: #a0e9ff !important; }
.on-dark .ant-typography-secondary, .user-message .message-time { color: rgba(255,255,255,0.75) !important; }
.on-dark .ant-btn-default { background: transparent !important; color: #ffffff !important; border-color: rgba(255,255,255,0.35) !important; }
.on-dark .ant-input, .on-dark .ant-input-affix-wrapper { background: rgba(255,255,255,0.06) !important; color: #fff !important; border-color: rgba(255,255,255,0.25) !important; }

/***** Footer *****/
.footer { background: var(--neo-card) !important; color: var(--neo-subtext) !important; border-top: 1px solid var(--neo-border) !important; }
.footer::before { background: linear-gradient(90deg, var(--neo-primary), var(--neo-accent)) !important; }
.footer .gitee-link { color: var(--neo-primary) !important; }
.footer .gitee-link:hover { color: var(--neo-accent) !important; }
.footer .legal-links a { color: var(--neo-subtext) !important; }

/***** App list *****/
.app-card-cover { background-color: rgba(22,104,220,0.06) !important; }
.app-card-cover-placeholder { color: var(--neo-primary) !important; background: linear-gradient(135deg, rgba(22,104,220,0.08), rgba(34,211,238,0.08)) !important; }
.app-description { color: var(--neo-subtext) !important; }

/***** Scrollbar (webkit) *****/
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--neo-primary), var(--neo-accent)); border-radius: 8px; }
body.dark-theme *::-webkit-scrollbar-thumb { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); } 